<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>结算账户</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../../css/common.css" media="all">
		<style type="text/css">
			.layui-table img,
			.layui-table video {
				width: 50px;
				max-width: 60px;
			}

			.tDiv {
				font-size: 10px;
				line-height: 13px;
			}

			.tDiv-price {
				font-size: 15px;
				line-height: 18px;
			}
		</style>

	</head>

	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">订单信息</div>
						<div class="layui-card-body">
							<!-- 搜索 -->
							<form class="layui-form search" id="form" onsubmit="return false" action="##">
								<div class="layui-inline search_inline">
									<label class="layui-form-label">时间段：</label>
									<div class="layui-input-inline" style="width: 300px;">
										<input class="layui-input" id="choosetime" placeholder="时间段" autocomplete="off">
										<input class="layui-input" type="text" id="starttime" name="starttime" placeholder="" autocomplete="off" style="display: none;">
										<input class="layui-input" type="text" id="endtime" name="endtime" placeholder="" autocomplete="off" style="display: none;">
									</div>
								</div>
								<div class="layui-inline search_inline">
									<label class="layui-form-label">应用编号：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="balance_pay_app_id" name="balance_pay_app_id" placeholder="编号" autocomplete="off">
									</div>
								</div>
								<div class="layui-inline search_inline">
									<label class="layui-form-label">订单号：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="order_no" name="order_no" placeholder="订单编号" autocomplete="off">
									</div>
								</div>
								<div class="layui-inline search_inline">
									<label class="layui-form-label">出账会员：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="out_member_id" name="out_member_id" placeholder="出账会员" autocomplete="off">
									</div>
								</div>
								<div class="layui-inline search_inline">
									<label class="layui-form-label">入账会员：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="in_member_id" name="in_member_id" placeholder="入账会员" autocomplete="off">
									</div>
								</div>
								<div class="layui-inline search_inline">
									<label class="layui-form-label">标题：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="goods_title" name="goods_title" placeholder="标题" autocomplete="off">
									</div>
								</div>
								<div class="layui-inline search_inline">
									<label class="layui-form-label">详情：</label>
									<div class="layui-input-inline">
										<input class="layui-input" lay-verify="goods_desc" name="goods_desc" placeholder="详情" autocomplete="off">
									</div>
								</div>
								<button class="layui-btn search_inline" lay-submit="" lay-filter="search"
									data-type="reload">搜索</button>
								<button class="layui-btn layui-btn-primary search_inline" type="reset">重置</button>
							</form>
							<!-- 搜索 -->
							<table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate"></table>
							<script type="text/html" id="test-table-operate-barDemo">
								<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="detail">明细</a>
								<a class="layui-btn layui-btn-xs" lay-event="orderdetail">订单详情</a>
								<!--<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="edit">配送</a>-->
								{{# if(d.status == 30 ){ }}
									<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="edit">配送</a>
									{{# } }}
							
										<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="edit_orders_sub">修改</a>
										<!--<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="wait_confirm">确认订单</a>-->
							</script>
							<!-- 订单信息 -->
							<script type="text/html" id="test-table-operate-order">
								<div class="tDiv left" style="text-align: left;line-height: 15px;">
									<font style="color: #000;">订单编号：{{d.orderid?d.orderid:''}}</font><br>
									<font style="color: #000;">平台订单号：{{d.transaction_id?d.transaction_id:''}}</font><br>
									<font style="color: #000;">商户订单号：{{d.order_id?d.order_id:''}}</font><br>
								</div>
							</script>
							<!-- 用户信息 -->
							<script type="text/html" id="test-table-operate-member">
								<div class="tDiv left" style="text-align: left;line-height: 15px;">
									<font style="color: #000;">会员编号：{{d.memberid?d.memberid:''}}</font><br>
									<font style="color: #000;">用户编号：{{d.userid?d.userid:''}}</font><br>
									<font style="color: #000;">账户编号：{{d.accountid?d.accountid:''}}</font><br>
								</div>
							</script>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="../../../layuiadmin/layui/layui.js"></script>
		<script src="../../../js/common.js"></script>
		<script>
			layui.config({
				base: '../../../layuiadmin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'table', 'form', 'laydate'], function() {
				var table = layui.table,
					$ = layui.$,
					form = layui.form,
					laydate = layui.laydate,
					admin = layui.admin;
				laydate.render({
					elem: '#choosetime',
					type: 'datetime',
					range: true,
					value: getstartime()+' - '+getendtime(),
					done: function(value, date) {
						$('input[name=starttime]').val(value.split(' - ')[0]);
						$('input[name=endtime]').val(value.split(' - ')[1]);
					}
				});
				$("#starttime").val(getstartime());
				$("#endtime").val(getendtime());
				var _data = {
					starttime: $("#starttime").val(),
					endtime: $("#endtime").val(),
				}
				payment_show('option');
				initdata();
				function initdata() {
					table.render({
						elem: '#test-table-operate',
						url: server.sys_balance_pay_query,
						height: 'full-155',
						cellMinWidth: cellMinWidth,
						limit: limit,
						limits: limits,
						cols: [
							[{
								field: 'app_id',
								width: 350,
								title: '应用编号',
							}, {
								field: 'order_no',
								width: 150,
								title: '订单号',
							}, {
								field: 'out_member_id',
								width: 150,
								title: '出账账户',
							}, {
								field: 'in_member_id',
								width: 150,
								title: '入账账户',
							}, {
								field: 'trans_amt',
								width: 90,
								title: '金额',
							}, {
								field: 'fee_amt',
								width: 90,
								title: '手续费',
							}, {
								field: 'goods_title',
								width: 90,
								title: '标题',
							}, {
								field: 'goods_desc',
								width: 90,
								title: '描述',
							}, {
								field: 'results',
								width: 200,
								title: '结果',
							}, {
								field: 'addtime',
								width: 160,
								title: '时间',
							}],
						],
						page: true,
						where: _data,
						request: {
							pageName: 'page',
							limitName: 'size' //每页数据量的参数名，默认：limit
						},
						parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
							return {
								"code": res.code, //解析接口状态
								"msg": res.msg, //解析提示文本
								"count": res.balance_pay.pager.total, //解析数据长度
								"data": res.balance_pay.data //解析数据列表
							};
						}
					});
				}
				//监听搜索
				form.verify({
					memberid: function(value, item) { //value：表单的值、item：表单的DOM对象
						if (!value) {
							return '不能为空';
						}
					}
				});
				//监听搜索
				form.on('submit(search)', function(data) {
					_data = data.field
					initdata();
					return false;
				});
				$("button[type=reset]").on("click", function(data) {
					_data = {}
					document.getElementById("form").reset();
					setTimeout(()=>{
						$("#choosetime").val(getstartime()+' - '+getendtime())
						$("#starttime").val(getstartime())
						$("#endtime").val(getendtime())
						_data.starttime = $("#starttime").val()
						_data.endtime = $("#endtime").val()
						initdata();
					},100)
				});
				var $ = layui.$,
					active = {
						getCheckData: function() { //获取选中数据
							var checkStatus = table.checkStatus('test-table-operate'),
								data = checkStatus.data;
							layer.alert(JSON.stringify(data));
						},
						getCheckLength: function() { //获取选中数目
							var checkStatus = table.checkStatus('test-table-operate'),
								data = checkStatus.data;
							layer.msg('选中了：' + data.length + ' 个');
						},
						isAll: function() { //验证是否全选
							var checkStatus = table.checkStatus('test-table-operate');
							layer.msg(checkStatus.isAll ? '全选' : '未全选')
						}
					};

				$('.test-table-operate-btn .layui-btn').on('click', function() {
					var type = $(this).data('type');
					active[type] ? active[type].call(this) : '';
				});
				function getstartime(){
					var today = new Date();
					var tYear = today.getFullYear();
					var tMonth = today.getMonth() + 1;
					var tDate = today.getDate();
					tMonth = doHandleMonth(tMonth)
					tDate = doHandleMonth(tDate)
					return tYear+"-"+tMonth+"-"+tDate+" 00:00:00";
				}
				function getendtime(){
					var today = new Date();
					var tYear = today.getFullYear();
					var tMonth = today.getMonth() + 1;
					var tDate = today.getDate();
					tMonth = doHandleMonth(tMonth)
					tDate = doHandleMonth(tDate)
					return tYear+"-"+tMonth+"-"+tDate+" 23:59:59";
				}
				function doHandleMonth(month){
					var m = month;
					if(month.toString().length == 1){
						m = "0" + month;
					}
					return m;
				}
			});
		</script>
	</body>

</html>
